import requests
# 引入正则表达式
import re



# request()方法的使用

base_url = r'https://'


# 访问 百度首页
url1 = base_url + 'www.baidu.com'
resp = requests.get(url1)
print(resp.status_code)
resp.encoding = 'utf-8'
print(resp.text)

# 访问豆瓣首页https://movie.douban.com/
url2 = base_url + 'movie.douban.com/'
# resp = requests.get(url2)
# print(resp.status_code)
# 以上代码不能访问，需要构造请求头


# # 法2
# resp = requests.request('get',url2)
# print(resp.status_code)

# # 访问ASMS首页
# base_url2 = r'http://172.16.22.108:8080'
# url = base_url2 + '/bsams/front/login.do'
# resp = requests.get(url)
# print(resp.status_code)